package com.wl.willChat.ui.login.activity

import android.content.Intent
import android.icu.util.DateInterval
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.CountDownTimer
import android.os.Handler
import android.util.Log
import android.widget.Button
import android.widget.TextView
import androidx.databinding.ViewDataBinding
import com.wl.willChat.R
import com.wl.willChat.base.BaseActivity
import kotlinx.coroutines.*
import java.sql.Date
import java.util.*

class SplashActivity : BaseActivity() {
    private lateinit var binding: ViewDataBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun getLayoutId()=R.layout.activity_splash

    override fun init(savedInstanceState: Bundle?) {
        binding=getViewDataBinding()
        MyCountDownTimer(3000,1000,findViewById(R.id.tv)).start()
    }

    private inner class MyCountDownTimer(
        mill: Long,
        countDownInterval: Long,
        internal var tv: TextView,
    ) : CountDownTimer(mill,countDownInterval){
        override fun onTick(millisUntilFinished: Long) {
            Log.e("WL",millisUntilFinished.toString())
            tv.text=""+millisUntilFinished/1000+"s后跳转"
        }

        override fun onFinish() {
            startActivity(Intent(this@SplashActivity,LoginActivity::class.java))
            cancel()
        }

    }
}